package com.zoe.onelink.actuate.info;

import com.zoe.onelink.common.constant.AppEnvConstant;
import com.zoe.onelink.core.util.OnelinkFrameworkInfoUtil;
import lombok.RequiredArgsConstructor;
import org.springframework.boot.actuate.info.Info;
import org.springframework.boot.actuate.info.InfoContributor;

/**
 * <p>标题: </p>
 * <p>描述: </p>
 * <p>版权: Copyright (c) 2022</p>
 * <p>公司: 智业软件股份有限公司</p>
 *
 * @version: 1.0
 * @author: ruansheng
 * @date: 2022-05-09
 */
@RequiredArgsConstructor
public class OnelinkFrmInfoContributor implements InfoContributor {

    private static final String UNKNOWN = "unknown";

    @Override
    public void contribute(Info.Builder builder) {
        String coreVersion = OnelinkFrameworkInfoUtil.getString(OnelinkFrameworkInfoUtil.Key.ONELINK_CORE_VERSION, UNKNOWN);
        String coreBuildTime = OnelinkFrameworkInfoUtil.getString(OnelinkFrameworkInfoUtil.Key.ONELINK_CORE_BUILD_TIME, UNKNOWN);
        builder.withDetail(AppEnvConstant.ONELINK_FRM_VERSION, coreVersion);
        builder.withDetail(AppEnvConstant.ONELINK_FRM_BUILD_TIME, coreBuildTime);
    }
}
